from  selenium import  webdriver
import  time
from  selenium.webdriver.chrome.service import  Service
#初始化驱动，指定chrome浏览器对象
service = Service("d:/chromedriver/chromedriver-win64/chromedriver.exe")
driver = webdriver.Chrome(service=service)
#driver = webdriver.Chrome()
#隐式等待：所有元素，如果尚未加载，等待10秒
driver.implicitly_wait(10)
#初始化驱动，指定chrome浏览器对象
#service = Service("d:/chromedriver/chromedriver-win64/chromedriver.exe")
#driver = webdriver.Chrome(service=service)
#请求豆瓣电影-排行版-剧情
driver.get("https://movie.douban.com/typerank?type_name=%E5%89%A7%E6%83%85&type=11&interval_id=100:90&action=")
time.sleep(5)
#忽略非法字符再编译
print(driver.page_source.encode("GBK","ignore").decode("GBK"))